var refPulseiras;
var refIngressos;
var refLanternas;
var refCarimbos;
var refTintas;
var refCordoes;
var refSelos;

var refContinuar;
var refLimparSec;
var refVoltar;
var refLimparTudo;
var refAnexar;
var refConcluir;

var refResumo;
var refDivPulseiras;

window.onload = function () {
    refPulseiras = document.getElementById("btnPulseiras");
    refIngressos = document.getElementById("btnIngressos");
    refLanternas = document.getElementById("btnLanternas");
    refCarimbos = document.getElementById("btnCarimbos");
    refTintas = document.getElementById("btnTintas");
    refCordoes = document.getElementById("btnCordoes");
    refSelos = document.getElementById("btnSelos");

    refContinuar = document.getElementById("btnContinuar");
    refLimparSec = document.getElementById("btnLimparSec");
    refVoltar = document.getElementById("btnVoltar");
    refLimparTudo = document.getElementById("btnLimparTud");
    refAnexar = document.getElementById("btnAnexar");
    refConcluir = document.getElementById("btnConcluir");

    refResumo = document.getElementById("resumo");
    refDivPulseiras = document.getElementById("divPulseiras");

    estadoInicial();
}

function estadoInicial() {
    menuSuperiorNormalTodos();

    exibirContinuarLimparVoltar(false);

    //refResumo.style.display = "block";

    refDivPulseiras.style.display = "none";
    document.getElementById("divIngressos").style.display = "none";
    document.getElementById("divLanternas").style.display = "none";
    document.getElementById("divCarimbos").style.display = "none";
    document.getElementById("divCordoes").style.display = "none";
    document.getElementById("divOrcamento").style.display = "none";
}

function menuSuperiorNormalTodos() {
    refPulseiras.className = "OrcmenuSuperiorNormal";
    refIngressos.className = "OrcmenuSuperiorNormal";
    refLanternas.className = "OrcmenuSuperiorNormal";
    refCarimbos.className = "OrcmenuSuperiorNormal";
    refTintas.className = "OrcmenuSuperiorNormal";
    refCordoes.className = "OrcmenuSuperiorNormal";
    refSelos.className = "OrcmenuSuperiorNormal";
}

function menu1Clique(id) {
    refPulseiras.style.display = "none";
    refIngressos.style.display = "none";
    refLanternas.style.display = "none";
    refCarimbos.style.display = "none";
    refTintas.style.display = "none";
    refCordoes.style.display = "none";
    refSelos.style.display = "none";

    menuSuperiorNormalTodos();

    if (id === "pulseira") {
        refPulseiras.style.display = "inline-block";
        refPulseiras.className = "OrcmenuSuperiorSelecionado";
        exibirPulseiras();
    }

    else if (id === "ingressos") {
        refIngressos.style.display = "inline-block";
        refIngressos.className = "OrcmenuSuperiorSelecionado";
        exibirIngressos();
    }

    else if (id === "lanternas") {
        refLanternas.style.display = "inline-block";
        refLanternas.className = "OrcmenuSuperiorSelecionado";
        exibirLanternas();
    }

    else if (id === "carimbos") {
        refCarimbos.style.display = "inline-block";
        refCarimbos.className = "OrcmenuSuperiorSelecionado";
        exibirCarimbos();
    }

    else if (id === "tintas") {
        refTintas.style.display = "inline-block";
        refTintas.className = "OrcmenuSuperiorSelecionado";
        exibirTintas();
    }

    else if (id === "cordoes") {
        refCordoes.style.display = "inline-block";
        refCordoes.className = "OrcmenuSuperiorSelecionado";
        exibirCordoes();
    }

    else {
        refSelos.style.display = "inline-block";
        refSelos.className = "OrcmenuSuperiorSelecionado";
        exibirSelos();
    }

}

// Funções para o menu superior
function exibirPulseiras() {
    exibirContinuarLimparVoltar(true);

    //refResumo.style.display = "none";
    refDivPulseiras.style.display = "block";

    esconderTiposPulseiras();
}

function esconderTiposPulseiras() {
    document.getElementById("puls1").style.display = "none";
    document.getElementById("puls2").style.display = "none";
    document.getElementById("puls3").style.display = "none";
    document.getElementById("puls4").style.display = "none";
}

//Funções de comportamento do menu inferior
function exibirContinuarLimparVoltar(exibir) {
    if (exibir == true) {
        refContinuar.className = "OrcmenuInferiorNormal";
        refLimparSec.className = "OrcmenuInferiorNormal";
        refVoltar.className = "OrcmenuInferiorNormal";
    }
    else {
        refContinuar.className = "OrcmenuInferiorDesabilitado";
        refLimparSec.className = "OrcmenuInferiorDesabilitado";
        refVoltar.className = "OrcmenuInferiorDesabilitado";
    }
}

function Voltar() {
    refPulseiras.style.display = "inline-block";
    refIngressos.style.display = "inline-block";
    refLanternas.style.display = "inline-block";
    refCarimbos.style.display = "inline-block";
    refTintas.style.display = "inline-block";
    refCordoes.style.display = "inline-block";
    refSelos.style.display = "inline-block";

    estadoInicial();
}



function selectTipoPulseiras(index) {
    document.getElementById("tpPuls1").className = "selectOcao";
    document.getElementById("tpPuls2").className = "selectOcao";
    document.getElementById("tpPuls3").className = "selectOcao";
    document.getElementById("tpPuls4").className = "selectOcao";

    esconderTiposPulseiras();

    document.getElementById("tpPuls" + index).className = "selectOcaoMarcado";
}

function pulsPVCSelect() {
    selectTipoPulseiras(1);
    document.getElementById("puls1").style.display = "block";
}

function pulsTyvecSelect() {
    selectTipoPulseiras(2);
    document.getElementById("puls2").style.display = "block";

}

function pulsHolograficaSelect() {
    selectTipoPulseiras(3);
    document.getElementById("puls3").style.display = "block";

}

function pulsDigitalSelect() {
    selectTipoPulseiras(4);
    document.getElementById("puls4").style.display = "block";
}

// Eventos para Pulseiras PVC

function puls11() {
	document.getElementById("puls11").className = "selectOcaoMarcado";
	document.getElementById("puls12").className = "selectOcao";
	
	document.getElementById("contPuls12").style.display = "none";
	document.getElementById("contPuls11").style.display = "block";
}

function puls12() {
	document.getElementById("puls12").className = "selectOcaoMarcado";
	document.getElementById("puls11").className = "selectOcao";
	
	document.getElementById("contPuls12").style.display = "block";
	document.getElementById("contPuls11").style.display = "none";

}

// Eventos para Pulseiras Tyvec

function desmarcPuls20()
{
	for(var i=1; i <= 4; i++)
	{
		document.getElementById("puls2" + i).className = "selectOcao";
	}
}

function puls20(id){
	desmarcPuls20();
	document.getElementById("puls2" + id).className = "selectOcaoMarcado";
	
	document.getElementById("contPuls2Cores").style.display = "block";
}

// Eventos para Holográfica especial

function desmarcPuls30(){
	for(var i=1; i <= 6; i++)
	{
		document.getElementById("puls3" + i).className = "selectOcao";
	}
}

function puls30(id){
	desmarcPuls30();
	document.getElementById("puls3" + id).className = "selectOcaoMarcado";
}

function puls41(){
	document.getElementById("puls42").className = "selectOcao";
	
	document.getElementById("puls41").className = "selectOcaoMarcado";
}

function puls42(){
	document.getElementById("puls41").className = "selectOcao";
	
	document.getElementById("puls42").className = "selectOcaoMarcado";
}

function cxPuls11(valor){
	document.getElementById("lblPus11Cor").innerText = valor.toString();
	document.getElementById("lisaOuColor").style.display = "block";
}

function puls11Lisa(){
	document.getElementById("contPuls11Lisa").className = "selectOcaoMarcado";
	document.getElementById("contPuls11Colo").className = "selectOcao";
	
	document.getElementById("puls11Qtd").style.display = "block";
}

function puls11Colo(){
	document.getElementById("contPuls11Colo").className = "selectOcaoMarcado";
	document.getElementById("contPuls11Lisa").className = "selectOcao";
	
	document.getElementById("puls11Qtd").style.display = "block";
}

function cxPuls20(valor){
	document.getElementById("lblPuls20Cor").innerText = valor.toString();
}

function puls30Monocromatc(){
	var btn = document.getElementById("puls3Monocromatic");
	
	if(btn.className == "selectOcao")
	{
		btn.className = "selectOcaoMarcado";
	}
	else
	{
		btn.className = "selectOcao";
	}
}

function exibirIngressos() {
    exibirContinuarLimparVoltar(true);

    //refResumo.style.display = "none";
    document.getElementById("divIngressos").style.display = "block";

    document.getElementById("tpIng1Cont").style.display = "none";
    document.getElementById("tpIng2Cont").style.display = "none";
}

function exibirTpIng1Cont() {
    document.getElementById("tpIng1").className = "selectOcaoMarcado";
    document.getElementById("tpIng2").className = "selectOcao";
    document.getElementById("tpIng1Cont").style.display = "block";
    document.getElementById("tpIng2Cont").style.display = "none";
}

function exibirTpIng2Cont() {
    document.getElementById("tpIng2").className = "selectOcaoMarcado";
    document.getElementById("tpIng1").className = "selectOcao";

    document.getElementById("tpIng1Cont").style.display = "none";
    document.getElementById("tpIng2Cont").style.display = "block";
}

function ing10(valor) {
    for (var i = 1; i <= 7; i++) {
        document.getElementById("ing1" + i).className = "selectOcao";
    }

    document.getElementById("ing1" + valor).className = "selectOcaoMarcado";
}

function ing10Passaporte() {
    var btn = document.getElementById("ing1Passport");

    if (btn.className == "selectOcao") {
        btn.className = "selectOcaoMarcado";

        document.getElementById("ing1Pas1").style.display = "inline-block";
        document.getElementById("ing1Pas2").style.display = "inline-block";
    }
    else {
        btn.className = "selectOcao";

        document.getElementById("ing1Pas1").style.display = "none";
        document.getElementById("ing1Pas2").style.display = "none";
    }
}

function ing1Pass0(valor) {
    if (valor == 1) {
        document.getElementById("ing1Pas1").className = "selectOcaoMarcado";
        document.getElementById("ing1Pas2").className = "selectOcao";
    }
    else {
        document.getElementById("ing1Pas1").className = "selectOcao";
        document.getElementById("ing1Pas2").className = "selectOcaoMarcado";
    }
}

function ing1Impr0(valor) {
    if (valor == 1) {
        document.getElementById("ing1Impr1").className = "selectOcaoMarcado";
        document.getElementById("ing1Impr2").className = "selectOcao";
    }
    else {
        document.getElementById("ing1Impr1").className = "selectOcao";
        document.getElementById("ing1Impr2").className = "selectOcaoMarcado";
    }
}

function ing1Vers0(valor) {
    if (valor == 1) {
        document.getElementById("ing1Vers1").className = "selectOcaoMarcado";
        document.getElementById("ing1Vers2").className = "selectOcao";
        document.getElementById("ing1Vers3").className = "selectOcao";
    }
    else if (valor == 2) {
        document.getElementById("ing1Vers1").className = "selectOcao";
        document.getElementById("ing1Vers2").className = "selectOcaoMarcado";
        document.getElementById("ing1Vers3").className = "selectOcao";
    }

    else {
        document.getElementById("ing1Vers1").className = "selectOcao";
        document.getElementById("ing1Vers2").className = "selectOcao";
        document.getElementById("ing1Vers3").className = "selectOcaoMarcado";
    }
}

function ing1Serr0(valor) {
    for (var i = 1; i <= 4; i++) {
        document.getElementById("ing1Serr" + i).className = "selectOcao";
    }

    document.getElementById("ing1Serr" + valor).className = "selectOcaoMarcado";
}

function ing1CdBarras() {
    var btn = document.getElementById("ing1BtnCdBarras");

    if (btn.className == "selectOcao") {
        btn.className = "selectOcaoMarcado";
    }
    else {
        btn.className = "selectOcao";
    }
}

function selectIngr2Barras() {
    var btn = document.getElementById("ingr2Barras");

    if (btn.className == "selectOcao") {
        btn.className = "selectOcaoMarcado";
    }
    else {
        btn.className = "selectOcao";
    }
}

function selectIngr2Tarjeta() {
    var btn = document.getElementById("ingr2Tarjeta");

    if (btn.className == "selectOcao") {
        btn.className = "selectOcaoMarcado";
    }
    else {
        btn.className = "selectOcao";
    }
}

function ingr2Cor0(valor) {
    for (var i = 1; i <= 4; i++) {
        document.getElementById("ingr2Cor" + i).className = "selectOcao";
    }

    document.getElementById("ingr2Cor" + valor).className = "selectOcaoMarcado";
}

function exibirLanternas() {
    exibirContinuarLimparVoltar(true);

    //refResumo.style.display = "none";
    document.getElementById("divLanternas").style.display = "block";
}


function tpLanterna0(valor) {
    for (i = 1; i <= 3; i++) {
        document.getElementById("tpLanterna" + i).className = "selectOcao";
    }

    document.getElementById("tpLanterna" + valor).className = "selectOcaoMarcado";
}

function exibirCarimbos() {
    exibirContinuarLimparVoltar(true);

    document.getElementById("divCarimbos").style.display = "block";
}

function exibirCordoes() {
    exibirContinuarLimparVoltar(true);

    document.getElementById("divCordoes").style.display = "block";
}

function cordLarg0(valor) {
    for (i = 1; i <= 6; i++) {
        document.getElementById("cordLarg" + i).className = "selectOcao";
    }

    document.getElementById("cordLarg" + valor).className = "selectOcaoMarcado";
}

function cordTerminais0(valor) {
    for (i = 1; i <= 3; i++) {
        document.getElementById("cordTerminais" + i).className = "selectOcao";
    }

    document.getElementById("cordTerminais" + valor).className = "selectOcaoMarcado";
}

function exibirSelos(){
    exibirContinuarLimparVoltar(true);

    document.getElementById("divCordoes").style.display = "block";
}

function tpSelos0(valor) {
    for (i = 1; i <= 4; i++) {
        document.getElementById("tpSelos" + i).className = "selectOcao";
    }

    document.getElementById("tpSelos" + valor).className = "selectOcaoMarcado";
}

function selectSeloAdicional() {
    var btn = document.getElementById("seloAdicional");

    if (btn.className == "selectOcao") {
        btn.className = "selectOcaoMarcado";
    }
    else {
        btn.className = "selectOcao";
    }
}

function exibirTintas() {
    exibirContinuarLimparVoltar(true);
}

